<?php
	
	session_start();
	require("connect.php");
	$link = connect_APO();
	
	require('check.php');
	is_logged_in();
	is_admin();
	
	require("header+logoutB.php");
	headerL();
	
	echo "<html>
<body class='main'>

<FONT class='mainFont'>
  <CENTER>
    <!--<p><img src = 'images/apopic.jpg'></p>-->
    <br>
	<br>
	  <div class='headerTable'>
	  <div id='links'>
	  <div id='backLink'> <A href='usersAdmin.php'>Back to Users Administration</A></div></div>
	  <b class='b1f'></b><b class='b2f'></b><b class='b3f'></b><b class='b4f'></b>
	  <div class='contentf'>
		  <div class = 'headerText'>
				Remove Midweek Credit from Users:
		  </div>
		  <div class='pad5'>Use this page to remove midweek credits from users. All the users are displayed with their current hours, with a field next to each of them. Input the hours to remove from them.</div>
		  <div class='pad20' style='padding-left: 100;'><div id='aCLab'><u>Name(User ID): Earned Credits</u></div><div><u>Credits To Remove</u></div></div>
		  <form action='removeUserCreditToDB.php' method='post'>
		  ";
		  
		$sql = sprintf("SELECT `ID`, `Fname`, `Lname`, `TotCredit` FROM `users` ORDER BY `Fname` ASC");
		$result= mysql_query($sql);
		
		$numberPeople=0;
		while($row = mysql_fetch_array($result)){
			$personID = $row["ID"];
			$personFName = $row["Fname"];
			$personLName = $row["Lname"];
			$personCredit =$row["TotCredit"];
			
			
			echo "<div class='pad5'><div class='aCRowLab'>$personFName $personLName($personID): $personCredit</div><div><input type='text' id='remCred' name='rem".$numberPeople."'/></div></div>
			";
			
			$numberPeople +=1;
		}
		
		$_SESSION['removeCredNum']=$numberPeople;
		
		echo "<div class='pad5'><input class='loginButton' type='submit' value='Submit'/></form>
		</div>
	  <b class='b4f'></b><b class='b3f'></b><b class='b2f'></b><b class='b1f'></b></div>
  </CENTER>
</FONT>
</body>
</html>
";

	require("footer.php");
	footer();

	mysql_close($link);
?>
